package com.os.ch3.condition;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * @Author Matt
 * @Date 2022-01-11
 * @Desc:
 * @Version V1.0
 */
@Configuration
public class ConditionConfig {

    @Bean
    @Conditional(WindowsCondition.class)  //符合windows条件实例化
    public ListService windowsListService(){
        return new WindowsListService();
    }

    @Bean
    @Conditional(LinuxCondition.class)  //如何linux条件实例化
    public ListService linuxListService(){
        return new LinuxListService();
    }
}
